package tr.edu.metu.is550.isell.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import tr.edu.metu.is550.isell.R;

public class AddCommentActivity extends Activity {

    Button btnSubmitComment;

    private void executeDone() {
        Intent resultIntent = new Intent();
        resultIntent.putExtra("value", ((EditText) findViewById(R.id.txtComment)).getText().toString());
        // Toast.makeText(getApplicationContext(), "comment valueE " + ((EditText) findViewById(R.id.txtComment)).getText() , Toast.LENGTH_SHORT).show();
        setResult(Activity.RESULT_OK, resultIntent);
        finish();
    }

    public void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_comment_dialog);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
        final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);

        btnSubmitComment = (Button) findViewById(R.id.btnAddComment);
        // Toast.makeText(getApplicationContext(), "INITIAL STEP  CREATE ÇÇÇÇÇ ", Toast.LENGTH_SHORT).show();

        btnSubmitComment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // Toast.makeText(getApplicationContext(), "BEFORE EZECUTE DONE ", Toast.LENGTH_SHORT).show();
                executeDone();

            }

        });


    }


}
